Link static libtiff dependencies#9635
Open
hholst80 wants to merge 1 commit into
Open
Conversation
Author
|
Validated that it does not mess up a so Ubuntu 24.04 normy build: docker run --rm -v /tmp/repro:/src -w /src ubuntu:24.04 bash -lc '
set -eux
rm -rf build src/pillow.egg-info
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential python3-dev python3-venv python3-pip pkg-config libtiff-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev libopenjp2-7-dev libimagequant-dev libraqm-dev libxcb1-dev binutils file ca-certificates
python3 -m venv /tmp/pillow-pr9635-venv
/tmp/pillow-pr9635-venv/bin/python -m pip install -U pip setuptools wheel pybind11
MAX_CONCURRENCY=2 /tmp/pillow-pr9635-venv/bin/python -m pip install -v --no-build-isolation --no-cache-dir .
so=$(/tmp/pillow-pr9635-venv/bin/python -c "import PIL._imaging, pathlib; print(pathlib.Path(PIL._imaging.__file__))")
printf "SO=%s\n" "$so"
/tmp/pillow-pr9635-venv/bin/python -c "from PIL import features; import PIL, pathlib; print(\"Pillow\", PIL.__version__); print(\"libtiff feature\", features.check(\"libtiff\")); print(\"libtiff version\", features.version(\"libtiff\")); print(\"PIL package\", pathlib.Path(PIL.__file__).parent)"
file "$so"
readelf -d "$so" | egrep "NEEDED|RPATH|RUNPATH" || true
ldd "$so" | egrep "tiff|jpeg|z|lzma|zstd|webp|jbig|deflate|not found" || true
' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
This updates the Pillow source build to include libtiff's pkg-config static link dependencies when the detected TIFF library is an archive.
For dynamic libtiff builds, behavior is unchanged. For static-only libtiff builds, Pillow now reads
pkg-config --libs --staticfor the libtiff module that resolvedTIFF_ROOT, adds its-Ldirectories, appends private-ldependencies after-ltiff, and passes through other linker flags such as-pthread.Why
On systems with
/usr/lib/libtiff.abut nolibtiff.so, Pillow previously linkedPIL._imagingwith-ltiff -ljpeg -lzonly. The build succeeded, but importingPIL._imagingfailed with unresolved libtiff private dependency symbols such asZSTD_compressStream.Addresses #9615.
Validation
Reproduced before the fix on a host with:
/usr/lib/libtiff.alibtiff.so*pkg-config --libs libtiff-4->-ltiffpkg-config --libs --static libtiff-4->-ltiff -lzstd -lm -lzstd -llzma -pthread -lpthread -ljpeg -lzAfter the fix:
MAX_CONCURRENCY=1 python -m pip install -v --no-build-isolation -C tiff=enable .python -c "import PIL._imaging"python selftest.py-> 59 tests passed